package com.mk.carcassonne.drawables;

import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.widget.ImageView;

public class RotatableImageView extends ImageView {

	private int _rotation = 90;
	
	public RotatableImageView(Context context) {
		super(context);
	}
	
	public RotatableImageView(Context context, AttributeSet attrs)
    {
        super(context, attrs);
    }
	
	@Override
	protected void onDraw(Canvas canvas) {
		canvas.save();
		canvas.rotate(_rotation, this.getWidth() / 2, this.getHeight() / 2);
	    super.onDraw(canvas);
	    canvas.restore();
	}

	public void setRotation(int rotation) {
		_rotation = rotation;
	}

	public int getRotation() {
		return _rotation;
	}
}
